<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <include file="Public:header" />
  <!--[if lt IE 9]>
    <script src="//cdn.bootcss.com/html5shiv/3.7.2/html5shiv.min.js"></script>
    <script src="//cdn.bootcss.com/respond.js/1.4.2/respond.min.js"></script>
  <![endif]-->
</head>
<body>
  <include file="Public:body_top" />

  <div class="container-fluid">
    <div class="row">
      <div class="col-sm-3 col-md-2 sidebar hidden-xs">
        <div class="menu">
          <dl>
            <dt><i class="cm-order"></i>小程序</dt>
            <dd><a href="{:U('Apps/xcx_edit')}">小程序配置</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=xcx_msg_edit">小程序模板消息</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=storage">存储配置</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=sms">短信配置</a></dd>
            <dd><a href="{:U('Apps/xcx_edit')}&tpl=withdraw">提现配置</a></dd>
            <dd class="active"><a href="{:U('Apps/xcx_edit')}&tpl=zidingyi">自定义</a></dd>
          </dl>
          <dl>
            <dt><i class="cm-advert"></i>广告管理</dt>
            <dd><a href="{:U('Adverts/index')}">广告列表</a></dd>
            <dd><a href="{:U('Adverts/add')}">新建广告</a></dd>
          </dl>
          <dl>
            <dt><i class="icon-uniE611"></i>帮助管理</dt>
            <dd><a href="{:U('Helps/index')}">帮助列表</a></dd>
            <dd><a href="{:U('Helps/add')}">新建帮助</a></dd>
          </dl>
        </div>
      </div>
      <div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
        <div class="main-hd">
          <h5>自定义图标</h5>
        </div>
<!--      <div class="main-bd">
          <div class="form-box">
            <form class="form-horizontal" method="post" action="{:U('Apps/xcx_update')}" enctype="multipart/form-data">
          <div class="form-group">
                <label class="col-sm-2 control-label ">浏览历史</label>
                <div class="col-sm-1">
                  <div class="uploadimg" id="uploadimg">
                    <i class="cm-plus"></i>
                    <input type="file" name="history_img" data-id="history-img" class="file-input">
                  </div>
                </div>
                <div class="col-sm-4">
                  <img id="history-img" src="{$app.history_img}" style=" width:78px; height:78px;">
                  <span class="tips">尺寸:180x180<br/>点击提交进行替换</span>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-sm-2 control-label ">用户中心</label>
                <div class="col-sm-1">
                  <div class="uploadimg" id="uploadimg">
                    <i class="cm-plus"></i>
                    <input type="file" name="user_img" data-id="user-img" class="file-input">
                  </div>
                </div>
                <div class="col-sm-4">
                  <img id="user-img" src="{$app.user_img}" style=" width:78px; height:78px;">
                  <span class="tips">尺寸:180x180<br/>点击提交进行替换</span>
                </div>
              </div>
              
              <div class="form-group">
                <label class="col-sm-2 control-label ">申请小店</label>
                <div class="col-sm-1">
                  <div class="uploadimg" id="uploadimg">
                    <i class="cm-plus"></i>
                    <input type="file" name="register_img" data-id="register-img" class="file-input">
                  </div>
                </div>
                <div class="col-sm-4">
                  <img id="register-img" src="{$app.register_img}" style=" width:78px; height:78px;">
                  <span class="tips">尺寸:180x180<br/>点击提交进行替换</span>
                </div>
              </div>

              <div class="form-group">
                <label class="col-sm-2 control-label ">登陆小店</label>
                <div class="col-sm-1">
                  <div class="uploadimg" id="uploadimg">
                    <i class="cm-plus"></i>
                    <input type="file" name="login_img" data-id="login-img" class="file-input">
                  </div>
                </div>
                <div class="col-sm-4">
                  <img id="login-img" src="{$app.login_img}" style=" width:78px; height:78px;">
                  <span class="tips">尺寸:180x180<br/>点击提交进行替换</span>
                </div>
              </div>

              <div class="form-group">
                <div class="col-sm-offset-2 col-sm-10">
                  <input type="hidden" name="id" value="{$app.id}">
                  <input type="hidden" name="tpl" value="{$tpl}">
                  <input type="submit" class="btn btn-primary" value="提交">                 
                </div>
              </div>
  
              </form>
          </div>          
        </div> -->
        </div>
      </div>
    </div>
</body>

<script type="text/javascript">
  if (typeof FileReader == 'undefined') {
    $('.uploadimg').html('<h1>当前浏览器不支持FileReader接口</h1>');
  }

  $('.file-input').change(function() {
    var file = this.files[0];
    console.log(file)
    var reader = new FileReader();
    var that = $(this);
    reader.onload = function(e) {
      var img = $('#' + that.attr('data-id'));
      img.attr('src', e.target.result)
    }

    reader.readAsDataURL(file);
  })


</script>
</html>